package code.c13;

/**
 * @author thinkpad - 83start
 * @version v1.0
 * @create 2022/12/2 14:42
 * @package code.c13
 * @description 生产者消费者 - 生产者线程
 */

public class ProducerThread extends Thread {
    private WareHouse wareHouse;

    public ProducerThread(WareHouse wareHouse) {
        this.wareHouse = wareHouse;
    }

    @Override
    public void run() {
        for (int i = 1; i < 10; i++) {
            try {
                sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            wareHouse.produce(i);
        }
    }
}
